package hook

import (
	"encoding/json"
	"os"
)

type Root struct {
	Path string `json:"path"`
}

type Spec struct {
	Version string `json:"ociVersion"`
	Root    Root   `json:"root"`
}

func LoadSpec(path string) (*Spec, error) {
	data, err := os.ReadFile(path)
	if err != nil {
		return nil, err
	}
	var s Spec
	if err := json.Unmarshal(data, &s); err != nil {
		return nil, err
	}
	return &s, nil
}
